package com.huishu.goods.fegin;

import com.huishu.commons.pojo.Result;
import com.huishu.commons.pojo.dto.FindAvailableCouponDTO;
import com.huishu.commons.pojo.vo.CouponVO;
import com.huishu.goods.fegin.fallback.CouponFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @ClassName：CouponFeignClient
 * @Author: ljj
 * @Date: 2023/4/10 14:29
 * @Description:
 */
@FeignClient(name = "coupon-server", path = "/coupon", fallbackFactory = CouponFeignClientFallBack.class)
public interface CouponFeignClient {

    /*@GetMapping("/coupon/findCouponByProductId/{productId}")
    Result<List<CouponVO>> findCouponByProductId(@PathVariable Long productId);


    @GetMapping("/findCouponByProductCategoryId/{productCategoryId}")
    Result<List<CouponVO>> findCouponByProductCategoryId(@PathVariable Long productCategoryId);*/

    @PostMapping("/coupon/find-available-coupon")
    Result<List<CouponVO>> findAvailableCoupon(@RequestBody FindAvailableCouponDTO findAvailableCouponDTO);


    @PostMapping("/coupon/find-coupon-byUserId/{userId}")
    Result<List<CouponVO>> findCouponByUserId(@PathVariable Long userId, @RequestBody List<Long> categoryId);

    @PostMapping("/coupon/find-repurchase-byUserId/{userId}")
    Result<List<CouponVO>> findRepurchaseByUserId(@PathVariable Long userId, @RequestBody List<Long> categoryId);


    /**
     * 绑定优惠卷
     * @param id
     * @param couponId
     * @return
     */
    @GetMapping("/coupon-product-relation/binding-coupon/{id}/{couponId}")
    Result bindingCoupon(@PathVariable Long id, @PathVariable Long couponId);

    /**
     * 解除绑定
     * @param id
     * @param couponId
     * @return
     */
    @GetMapping("/coupon-product-relation/delete-coupon/{id}/{couponId}")
    Result deleteCoupon(@PathVariable Long id, @PathVariable Long couponId);

    /**
     * 根据ids查询绑定的复购卷
     * @param
     * @return
     */
    @PostMapping("/coupon/findCouponByProductIds")
    Result<List<CouponVO>> findCouponByProductIds(@RequestBody List<Long> ids);
}
